// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property, executeInEditMode } = cc._decorator;

@ccclass
@executeInEditMode
export default abstract class baseShap extends cc.Component {
    @property({
        serializable: false,
        tooltip: CC_DEV && '是否需要编辑此图形组件'
    })
    protected editing: boolean = false

    /**
     * 位置偏移
     */
    @property
    protected _offset: cc.Vec2 = cc.v2(0, 0)
    @property({
        tooltip: '位置偏移'
    })
    get offset() { return this._offset };
    set offset(value) {
        this._offset = value;
        this.node && this.node.emit('offset-change');
    };

    onLostFocusInEditor() {
        this.editing = false;
    }

    abstract contains(point: cc.Vec2): boolean
}
